﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using HelloMinasan.Framework.Web.Validation;
using HelloMinasan.Domain;
using System.ComponentModel;
using HelloMinasan.Resources;

namespace HelloMinasan.Web.ViewModels
{
    public class MemberInvitationModel
    {
        public MemberInvitationModel()
        {
            Agree = true;

            Language = LanguageId = 2; //Vietnamese
            ForeignLanguageId1 = 1;//English

            ReturnUrl = "/MemberProfile";
        }

        public string Id { get; set; }

        [StringLength(50)]
        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "MemberRegister_YourFirstNameEmpty")]
        public string FirstName { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "MemberRegister_YourLastNameEmpty")]
        [StringLength(50)]
        public string LastName { get; set; }

        public string FullName
        {
            get { return String.Concat(FirstName, " ", LastName); }
        }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "MemberRegister_YourDisplayNameEmpty")]
        //[RegularExpression(@"[\w\.\-_À-ÿ ]{5,50}", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "DisplaynameInvalidObject")]
        [StringLength(50, ErrorMessageResourceType = typeof(Resources.Resource),
            ErrorMessageResourceName = "MemberSetting_PleaseInputAtLeast", MinimumLength = 5)]
        public string DisplayName { get; set; }


        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "MemberRegister_YourCaptchaEmpty")]
        [Display(Name = "Common_YourCaptcha", ResourceType = typeof(Resource))]
        public string Captcha { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "Member_YourPasswordEmpty")]
        [RegularExpression(@".{6,999}", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "ValidPassword")]
        [StringLength(50, ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "InValidMaxSize")]
        public string Password { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "Member_YourPasswordConfirmEmpty")]
        //[Compare("Password", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "RetypePass")]
        [StringLength(50, ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "InValidMaxSize")]
        public string RetypePassword { get; set; }

        [CheckboxRequired(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "TermAccept")]
        public bool Agree { get; set; }

        public string InviterId { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "YourEmailEmpty")]
        [RegularExpression(@"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$", ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "EmailInvalid")]
        [StringLength(100, ErrorMessageResourceType = typeof(Resources.Resource), ErrorMessageResourceName = "InValidMaxSize")]
        public string Email { get; set; }

        //Just deleted
        //public string PathologyId { get; set; }
        //public string PathologyDetail { get; set; }

        public int LanguageId { get; set; }
        public int ForeignLanguageId1 { get; set; }
        public int ForeignLanguageId2 { get; set; }
        public int ForeignLanguageId3 { get; set; }

        public string ReturnUrl { get; set; }

        public IList<Language> ListLanguage { get; set; }
        public int Language { get; set; }
    }
}